package com.spic.business.alarm.controller;

import com.spic.business.alarm.service.IAlarmDataService;
import com.spic.common.core.web.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * IOC告警数据查询
 */
@RestController
@RequestMapping("/alarms")
public class AlarmDataController {
    private static final Logger log = LoggerFactory.getLogger(AlarmDataController.class);

    @Autowired
    private IAlarmDataService alarmDataService;

    /**
     * 获取防疲劳系统告警数据列表汇总-当天数据
     *
     * @return
     */
    @GetMapping("/getAlarmList")
    public AjaxResult getAlarmList(@RequestParam("type") String type, @RequestParam("date") String date) {
        return AjaxResult.success(alarmDataService.getAlarmList(type, date));
    }

    /**
     * 获取防汛警数据列表汇总-当天数据
     *
     * @return
     */
    @GetMapping("/getFloodAlarm")
    public AjaxResult getFloodAlarm() {
        return AjaxResult.success(alarmDataService.getFloodAlarm());
    }

    /**
     * 获取违章举报数据列表汇总
     *
     * @param type 分类
     * @param date day=当天数据，month=当月数据
     * @return
     */
    @GetMapping("/getInformationList")
    public AjaxResult getInformationList(@RequestParam("type") String type, @RequestParam("date") String date) {
        return AjaxResult.success(alarmDataService.getInformationList(type, date));
    }

    /**
     * 获取隐患排查数据
     *
     * @return
     * @date week=7天内数据，year=当年数据
     */
    @GetMapping("/getHiddenList")
    public AjaxResult getHiddenList(@RequestParam("date") String date) {
        return AjaxResult.success(alarmDataService.getHiddenList(date));
    }
}
